<template>
    <div>
        <ul class="menu_top_list ">
            <li @click="add()">
                <span class="iconfont icon-fanhui"></span>
            </li>
            <li>{{ this.rbq && this.rbq.title }}</li>
            <router-link tag="li" to="/home" class="index-btn"></router-link>

        </ul>
        <div class="game-img">
            <i @click="flag = !flag"></i>
            <img :src="this.rbq && this.rbq.im">
        </div>
        <div class="video-wraper" v-show="flag">
            <div class="pop-video">
                <div class="video-box">
                    <video style="width:100%; height:100%;margin: 0 auto;" controls="false"
                        playsinline="isiPhoneShowPlaysinline" x5-video-player-type="h5-page"
                        t7-video-player-type="inline" webkit-playsinline="isiPhoneShowPlaysinline" x-webkit-airplay=""
                        preload="auto" autoplay v-if="flag">
                        <source :src="this.list" type="video/mp4">
                    </video>
                </div>
                <div class="video-close" @click="flag = !flag"></div>
            </div>
        </div>
        <div class="con-game">
            <p>
                <img :src="this.rbq && this.rbq.pic">
                <em>{{ this.rbq && this.rbq.title }}</em>
                <span>{{ this.rbq && this.rbq.category }}<b>|</b>人气:<i>{{ this.rbq && this.rbq.wapclicks }}</i></span>
                <span>{{ this.rbq && this.rbq.html5introduce }}</span>
                <a class="fav" style="" v-show="!this.bbq.guan" @click="Sign">收藏</a>
                <a class="faved" v-show="this.bbq.guan" @click="sin()">取消收藏</a>

            </p>
            <div class="btn cf nodown" id="nodown">
                <span class="start" @click="start">
                    开始游戏

                </span>
            </div>
        </div>
        <div class="bannerbox" v-if="play">
            <div class="swiper" @click="play = !play">
                <van-swipe class="my-swipe" indicator-color="white" @change="onChange">

                    <van-swipe-item v-for=" (item, index) in rbq && rbq.swiper" :key="index">

                        <img :src="item.img" alt="" style="width: 100%;height: 100%;border-radius: 10px; opacity:1;">

                    </van-swipe-item>


                </van-swipe>
            </div>

        </div>
        <van-tabs animated v-model="active">
            <van-tab title="详情">
                <div class="md-gamepic" @click="play = !play">
                    <div class="swiper-screenshot">
                        <div class="swiper-box-new">
                            <div class="swiper-container2" id="swiper-container2">
                                <div class="swiper-wrapper2">
                                    <div class="swiper-slide2" v-for=" (item, index) in rbq && rbq.swiper" :key="index">
                                        <img :src="item.img">
                                    </div>

                                </div>
                            </div>
                        </div>

                    </div>
                </div>

                <div class="md-gameintr mgb32">
                    <div class="bd-tit">简介</div>
                    <div class="intr-content " style="">
                        <div class="intr-pp">
                            《零之战线》是一款二次元放置类手游，玩家作为高级学校毕业的优等生，体验游戏内丰富的策略搭配、养成玩法、竖版挂机、休闲玩法。指挥武器少女战队与被污染的机械兽战斗，在夺回地面控制权的同时，迎击与调查隐藏在深处的秘密。现在，为了维护人类的文明，请战斗吧！
                        </div>
                    </div>
                    <div class="manufacturer cf">
                        <em>提供商：</em>
                        <p>海南霆维网络科技有限公司</p>
                    </div>

                </div>
                <div class="md-gameintr mgb32">
                    <div class="bd-tit">游戏相关</div>

                    <div class=" gamedesc">
                        <div class="lista">
                            <img :src="this.rbq && this.rbq.img" alt="" style=" z-index: 555;position: absolute;
">
                        </div>
                        <div class="liste">
                            <img src="../assets/images/暂无游戏.jpg" alt="">
                        </div>


                    </div>



                </div>
                <div class="md-gameintr mgb32">
                    <div class="bd-tit">游戏推荐</div>
                    <div class="bd cf">
                        <ul>
                            <li v-for=" (item, index) in allGame && allGame.slice(0, 4) " :key="'ifo-' + index">
                                <router-link :to="'./GameDetails?id=' + item.id">


                                    <img :src="item.pic">

                                    <i></i>
                                </router-link>
                                <em>{{ item.title }}</em>
                            </li>
                        </ul>
                    </div>




                </div>
            </van-tab>

            <van-tab title="评论">
                <div class="comment-title mgb32" @click="ikun1">
                    <div class="comment-url opendialog">真实、客观、丰富的评论内容，更容易获得大家的赞哦~</div>
                </div>
                <div class="max-top mgb32">
                    <div id="page">
                        <div class="Pinglunfont book_bk_qs1 ">
                            <ul id="Pinglun_body" style="margin:0.1rem;" v-for="(items, index) in pink"
                                :key="'I-nfo-' + index">
                                <li class="clear">
                                    <figure>
                                        <img :src="items.img" width="80" height="80">
                                    </figure>
                                    <div class="Pinglun_Content2">
                                        <span><b>{{ items.name }}</b><em></em>
                                            <br>{{ items.time }}</span>
                                    </div>
                                    <p>{{ items.pad }} </p>
                                </li>
                            </ul>
                            <ul id="Pinglun_body" class="max-bom"  v-for="(item, index) in downloadLists "
                    :key="'I-nfo' + index">
                    <li class="clear">
                        <figure>
                            <img :src="item.img" width="80" height="80">
                        </figure>
                        <div class="Pinglun_Content2">
                            <span><b>{{ item.name }}</b><em>{{ item.frit }}</em>
                                <br> {{ item.time }}</span>
                        </div>
                        <p>{{ item.pad }} </p>



                    </li>
                </ul>


                        </div>

                    </div>
                </div>

            </van-tab>
        </van-tabs>
    </div>
</template>
<script>
import { allGame, getPink } from '@/api/home';
import axios from "axios"

// import { Toast } from 'vant';
import { Dialog } from 'vant';

export default {
    data() {
        return {
            allGame: [],
            flag: false,
            play: false,
            indexSwiper: 0,
            index1: 1,
            rbq: null,
            active: 0,
            list: [],
            guan: null,
            pink: [],
            downloadLists: [],
            edg: [],
            bbq: [],
            abq: null
        }
    },
    methods: {
        getNowTime() {
            var date = new Date();
            var time = date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
            this.newTime = time;
        },
        ikun1() {
            this.$router.push("/pinkView")

        },


        start() {
            this.$store.commit("bookLookFun", this.rbq);

            this.$router.push({ path: '/start', query: { id: this.$route.query.id } })


        },
        Sign() {
            
          this.bbq.guan= this.rbq.guan = true
            console.log("rbq", this.rbq);

            this.$store.commit("collectFun", this.rbq);

        },
        sin(index) {
            
            Dialog.confirm({
                title: "确定取消收藏喵？",
                message: "QWQ",
            })
                .then(() => {
                    this.bbq.guan= this.rbq.guan = false
            console.log("!rbq", this.rbq);
            // this.$store.commit("collectdel")
            this.$store.commit("collectFundel",index)
                })
                .catch(() => {
                    // on cancel
                });
        },

        onChange(index) {
            this.indexSwiper = index;
            console.log("in", this.indexSwiper);
        },
        // 返回go(-1)
        add() {
            this.$router.go(-1)
        },

    },
    watch: {
        // 正常跳转
        // '$route': function (to, from) {
        //     this.changeTab()
        // }
        $route() {
            location.reload();

        },
    },
    mounted() {

        allGame().then(data => {
            let arr = data.data;
            this.allGame = data.data
            this.allGame.sort(function () { return Math.random() > 0.5 ? -1 : 1; })
            const map = new Map()
            this.qc = arr.filter(key => !map.has(key.id) && map.set(key.id, 1)) // 这里对name属性进行去重

            let index = this.qc.findIndex(item => item.id == this.$route.query.id);
            this.rbq = this.qc[index]




        })

        getPink().then(data => {
            let arr = data.pink;
            console.log(arr);
            this.pink = data.pink;


        })
        // this.getStochasticData()

        axios.get('https://apis.netstart.cn/xpc/article/11' + this.$route.query.id)
            .then(data => {
                this.list = data.data.data.video.content.progressive[0].https_url;
                console.log("lsit", this.list);


            })



    },
    created() {
        // this.guan = window.localStorage.getItem("guan");
        // this.bbq=[]
        this.edg = this.$store.state.collect
        let index1 = this.edg.findIndex(item => item.id == this.$route.query.id);
        this.bbq = this.edg[index1];
        console.log("bbq", this.bbq);
        if (this.bbq == undefined) {

            this.bbq = { guan: false },

                // this.bbq.unshift( 1)
                console.log("bbq", this.bbq);
        }

        this.getNowTime();//进入页面调用该方法获取当前时间
        clearInterval(myTimeDisplay);//销毁之前定时器
        var myTimeDisplay = setInterval(() => {
            this.getNowTime(); //每秒更新一次时间
        }, 1000);

        this.downloadLists = this.$store.state.downloadLists;
        // this. changeTab()
    }


}
</script>

<style lang="scss" scoped>
.comment-title .comment-url {
    padding: 5px 5px 0 31px;
    height: 54px;
    line-height: 21px;
    border-radius: 2px;
    border: 1px #ccc solid;
    box-sizing: border-box;
    color: #959595;

}



figure img {
    width: 35px;
    height: 35px;
}


img {
    border: none;
    vertical-align: middle;
}

#Pinglun_body li {
    color: #666;
    overflow: hidden;
    font-size: 12.89px;
}

#Pinglun_body li figure {
    float: left;
}

figure {
    border-radius: 17.577px;
    overflow: hidden;
    height: 35.154px;
    width: 35.154px;
    margin: 0 9.374px 0 0;
}

figure {
    display: block;
    /* margin-block-start: 1em;
    */
    margin-block-end: 1em;
    /* margin-inline-start: 40px;
    margin-inline-end: 40px;
    */
}

.Pinglun_Content2 {
    padding: 0 0 5.859px 0;
    display: flex;
    justify-content: flex-start;
    -webkit-box-align: center;
    align-items: center;
}

.Pinglunfont a {
    color: #666;
    text-decoration: none;
}

#Pinglun_body li p {
    text-align: left;
    margin: 5.859px 0 0 0;
    line-height: 1.8em;
    text-indent: 2em;
    font-size: 11.718px;
    border-bottom: 1px solid #eaeaea;

}

p {
    display: block;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
}

.Pinglunfont a {
    color: #666;
    text-decoration: none;
}

.max-bom:last-child {
    margin-bottom: 150px
}

.post_but {
    width: 70.2px;
    height: 35.1px;
    color: #fff;
    font-size: 15.21px;
    background: #F90;
    border-radius: 18.72px;
    margin: 4px 0;
    display: -webkit-box;
    -webkit-box-pack: center;
    -webkit-box-align: center;
}


.book_view_bom {
    background-color: #F3F3F3;

    height: 40px;


    z-index: 90;
    width: 100%;
    top: 0;
}

.investment {


    z-index: 90;
    justify-content: center;
    padding-top: 5px;

    input {


        width: 100%;
        padding: 5px 0;
        border-radius: 10px;
        text-indent: 10px;
        border: 1px solid #999;
    }
}

#Pinglun_body li {
    // background: url(//rs.sfacg.com/web/m/images/xx.gif) repeat-x bottom;
    background-size: 2px;
}

.Pinglun_Content2 {
    B {
        font-weight: normal;
        font-size: 0.11rem;
        color: #3686d8;
    }

    em {
        margin-left: 5px;
        color: #ff6600;
        font-style: normal;
        font-size: 0.11rem;
    }
}


.max-top {}

.bd li img {
    width: 62px;
    height: 62px;
    border-radius: 8px;
    display: block;
    margin: 0 auto;

}

.bd li em {
    line-height: 1.4;
    margin-top: 5px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    word-break: break-all;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 12px;
}

.bd li a {
    color: #333;
    text-decoration: none;
    outline: none;
}

.bd li {
    text-align: left;
    width: 62px;
    margin: 5px 0 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    word-break: break-all;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    overflow: hidden;
    line-height: 1.4;

}

.bd ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.md-gameintr p {
    color: #959595;
    font-size: 14px;
    text-indent: 0 100px;
    text-align: justify;
    line-height: 22px;
    position: relative;
}

.manufacturer p {
    float: left;
    margin-left: 2%;
    width: 80%;
    color: #00cc7d;
    text-indent: 0;
}


.manufacturer em {
    float: left;
    width: 18%;
    color: #959595;
}

.manufacturer {
    margin-top: 10px;
    font-size: 14px;
}

.intr-content .intr-pp {
    width: 100%;
    text-indent: 2em;
    display: block;
    text-align: justify;

}

.intr-content {
    overflow: hidden;
    position: relative;
    font-size: 14px;
    line-height: 19px;
    width: 100%;
}

.gamedesc .gamedesc {
    z-index: 555;
    position: absolute;

}

.gamedesc .liste {

    z-index: 1;

    img {
        object-fit: cover;
    }

}

.gamedesc {
    position: relative;

    height: 208px;
    width: 355px;
    margin: 0 auto;

    img {
        width: 100%;
        height: 100%;
        display: block;


    }
}

.bd-tit {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    height: 20px;
    line-height: 20px;
    margin-bottom: 9px;

}

.mgb32 {
    margin-bottom: 16px;
    padding: 0 10px;
}

::-webkit-scrollbar {
    width: 0 !important;
}

::-webkit-scrollbar {
    width: 0 !important;
    height: 0;
}

.my-swipe {
    margin-top: 50px;
    display: flex;

    .van-swipe-item {
        display: flex;

        color: #fff;
        font-size: 20px;
        line-height: 150px;
        text-align: center;
        background-color: rgb(0, 0, 0);
        height: 625px;
        z-index: 10001111;
        opacity: 1
    }
}

.bannerbox {
    position: fixed;
    position: relative;
    background-image: linear-gradient(#E9ECEC, #ffffff);


    .swiper {

        position: absolute;
        top: -30px;
        position: fixed;



        background: rgb(0, 0, 0);
        width: 100%;
        height: 3000px;
        z-index: 1000;
        overflow: hidden;



    }
}


.swiper-screenshot .swiper-box-new1 {
    position: relative;
    z-index: 0;
    overflow: auto;
}

.swiper-box-new .swiper-container2 .swiper-slide2 img {
    max-height: 165px;
    margin-right: 5px;
    box-sizing: border-box;
    border: 1px #ccc solid;
    width: 100px;
    border-radius: 10px;
}


.swiper-box-new .swiper-container2 .swiper-slide2 {
    display: inline-block;
}

.swiper-box-new .swiper-container2 .swiper-wrapper2 {
    font-size: 0;
    white-space: nowrap;
}

.swiper-box-new .swiper-container2 {
    max-height: 225px;
    overflow-x: auto;
    overflow-y: hidden;
}

.swiper-screenshot .swiper-box-new {
    position: relative;
    z-index: 0;
    overflow: auto;
}

.md-gamepic {
    margin: 16px 0 30px;
    padding: 0 10px;
}

::v-deep .van-tabs__wrap {
    padding: 0 10px;
    border-bottom: 1px solid #eaeaea;
}

::v-deep .van-tabs__nav--line {
    padding-bottom: 0.3rem;

}

::v-deep .van-tab--active {
    font-weight: bold;
}

::v-deep .van-tabs__line {
    background-color: #00cc7d;
}



.con-game p a {
    position: absolute;
    top: 7px;
    width: 50px;
    height: 23px;
    line-height: 23px;
    padding-top: 23px;
    text-align: center;
    color: #959595;
    left: 295px;
}

.con-game .nodown a,
.con-game .nodown span,
.con-game .nodown .start {
    display: block;
    width: 100%;
    height: 40px;
    line-height: 40px;
    border-radius: 6px;
    background: #00cc7d;
    text-align: center;
    font-size: 18px;
    color: #fff;
    padding: 0;
}

.con-game .nodown {
    width: 270px;
    margin: 0 auto;
    text-align: center;
}

.con-game .btn {
    overflow: hidden;
    padding-top: 19px;
}

.con-game p .faved {
    right: 50px;

    background: url("https://h.4399.com/images/2022/icon.png") no-repeat 15px -230px;
    background-size: 50px 1400px;

}


.con-game p .fav {
    right: 50px;

    background: url("https://h.4399.com/images/2022/icon.png") no-repeat 15px -177px;
    background-size: 50px 1400px;

}

.con-game p span b {
    margin: 0 5px;
    font-weight: normal;
}

.con-game p span i {
    color: #ff8737;
}

.con-game p span {

    display: block;
    height: 18px;
    line-height: 18px;
    margin-left: 78px;
    color: #959595;
    overflow: hidden;
    text-overflow: ellipsis;

}

.con-game p em {
    display: block;
    height: 26px;
    line-height: 26px;
    font-size: 16px;
    margin-left: 78px;
    overflow: hidden;
}

em,
i {
    font-style: normal;
    vertical-align: top;
}

.con-game p img {
    float: left;
    width: 62px;
    height: 62px;
    border-radius: 10px;
}

.con-game p {
    position: relative;
    height: 62px;
    padding-right: 82px;
}

.con-game {
    padding: 19px 10px;
    margin-top: 48px;
}

.video-close {
    position: absolute;
    bottom: -50px;
    background: url("https://h.4399.com/images/2022/close.png") no-repeat center;
    width: 30px;
    height: 30px;
    background-size: 15px 15px;
    border-radius: 50%;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
    left: 50%;
    border: 1px solid #fff;
}

.pop-video video {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.pop-video {
    width: 100%;
    height: 208px;
    position: absolute;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
}

.video-wraper {
    z-index: 99;
    background: rgba(0, 0, 0);
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0px;
    left: 0px;
    // display: none;

}

.game-img img {
    width: 100%;
    height: 100%;
    display: block;
}

.game-img i {
    width: 100%;
    height: 100%;
    background: url("https://h.4399.com/images/2022/icon_details_play.png") no-repeat center;
    background-size: 43px 43px;
    position: absolute;
    z-index: 2;
    left: 0;
    top: 0;
}

.game-img {
    top: 48px;
    overflow: hidden;
    position: relative;
    height: 208px;
    width: 100%;
}

.loadmore p span {
    position: absolute;
    top: 0;
    left: 50%;
    margin-left: -60px;
    display: block;
    width: 120px;
    background: #fff;
}

.loadmore p::before {
    display: block;
    position: absolute;
    top: 16px;
    left: 50%;
    width: 250px;
    margin-left: -125px;
    height: 1px;
    background-image: linear-gradient(to right, #f1f1f1 0%, #d7d7d7 50%, #f1f1f1 100%);
    content: "";
}

.loadmore p {
    text-align: center;
    color: #959595;
    font-size: 14px;
    position: relative;
    height: 32px;
}

.loadmore {
    height: 32px;
    line-height: 32px;
    background: #fff;
    text-align: center;
}

.loadmore {
    height: 32px;
    line-height: 32px;
    text-align: center;
    margin: 20px 0;
    color: #b4b3b3;
}


.md-con-fixed {
    height: 48px;
}

.con-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    line-height: 48px;
    background: #fff;
    color: #333333;
    z-index: 99;
}

.con-header em {
    display: block;
    height: 48px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
}

em,
i {
    font-style: normal;
    vertical-align: top;
}

.index-btn {
    background: url("https://h.4399.com/images/2022/backindex_icon.png") no-repeat -9px 0;
    background-size: 28px;
    width: 40px;
    height: 38px;
    right: 0;
    background-position: 5px 14px;
    cursor: pointer;
}

.menu_top_list {
    max-width: 500px;
    margin: 0 auto;
    position: fixed;
    height: 48px;
    width: 100%;
    background-color: white;
    color: #333;
    font-size: 16px;
    font-weight: bold;

    z-index: 90;
    top: 0;
}

.menu_top_list li+li {
    width: 64%;
    -webkit-box-pack: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.menu_top_list li {
    float: left;
    display: -webkit-box;
    -webkit-box-align: center;
    height: 48px;
}

.menu_top_list li:first-child {
    cursor: pointer;
    width: 18%;
    color: #BFBFBF;
    font-size: 20px
}

.menu_top_list li:last-child {
    width: 18%;
}

.menu_top_list li:first-child::before {
    background: url("https://rs.sfacg.com/web/m/images/menu_top_icon.png") no-repeat -49.216px 9.96px;
    background-size: 105.462px;
    content: "";
    height: 46.8px;
    width: 24.608px;
    display: block;
}
</style>